//
//  AMPRegisterSetPwdViewController.swift
//  LivingHelper
//
//  Created by Ampaw on 2017/9/14.
//  Copyright © 2017年 Ampaw. All rights reserved.
//

import UIKit

class AMPRegisterSetPwdViewController: AMPBaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.title = "设置登陆密码"
        // 准备UI
        setUpUI()
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.view.endEditing(true)
    }
    
    // MARK: - 准备UI
    private func setUpUI() {
        self.registerView.registerSetPwdViewDelegate = self
        self.view.addSubview(self.registerView)
        
        unowned let WS = self
        self.registerView.snp.makeConstraints { (make) -> Void in
            make.edges.equalTo(WS.view)
        }
    }
    
    // MARK: - 懒加载
    lazy var registerView: AMPRegisterSetPwdView = {
        let registerView = AMPRegisterSetPwdView()
        
        return registerView
    }()
}

// MARK: - 扩展
/// 扩展 AMPRegisterSetPwdViewController 实现 AMPRegisterSetPwdViewDelegate 协议
extension AMPRegisterSetPwdViewController: AMPRegisterSetPwdViewDelegate {
    func didRegisterAndLogin() {
        self.view.endEditing(true)
        print("注册并登录")
        self.dismiss(animated: true, completion: nil)
    }
}
